/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package backupmonografia;

import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipException;

/**
 *
 * @author eduardo
 */
public class BackupMonografia {

    public static void main(String[] args) {
        //formato java -jar BackupMonografia.jar

        ZipFile z = new ZipFile();
        File[] files = new File[1];
        files[0] = new File("/home/eduardo/Documentos/Monografia/Monografia Atual");
        File f = new File("/home/eduardo/Documentos/Monografia/backup.zip");
        try {
            z.criarZip(f, files);

            SimpleMail mail = new SimpleMail();
            try {
                mail.sendMail("[Monografia Pos] Backup do dia " + new Date(), "Backup do dia " + new Date(), "edruela@gmail.com", "edruela@gmail.com", "ontedr2005", f);
                
            } catch (Exception ex) {
                Logger.getLogger(BackupMonografia.class.getName()).log(Level.SEVERE, null, ex);
            }

            f.delete();
        } catch (ZipException ex) {
            Logger.getLogger(BackupMonografia.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(BackupMonografia.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}
